package io.xccit.type;

import java.util.*;

/**
 * @author CH_ywx
 * @version 1.0
 * @create 2024/4/10
 * <p>体育彩票</p>
 */
public class Sports {

    /**
     * 大乐透
     */
    public void bigLottery(){
        int[] luckyForward = new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35};
        int[] luckyBack = new int[]{1,2,3,4,5,6,7,8,9,10,11,12};
        Random luckyRandom = new Random();
        Set<Integer> forwardNumbers = new HashSet<>();
        Set<Integer> backNumbers = new HashSet<>();
        while (forwardNumbers.size() < 5){
            forwardNumbers.add(luckyForward[luckyRandom.nextInt(luckyForward.length)]);
        }
        while (backNumbers.size() < 2){
            backNumbers.add(luckyBack[luckyRandom.nextInt(luckyBack.length)]);
        }
        System.out.println("Forward numbers: " + forwardNumbers + " Back numbers: " + backNumbers);
    }

    /**
     * 排列3
     */
    public void arrangement3(){
        Map<String,Integer> lucyResult = new LinkedHashMap<>();
        Random luckyRandom = new Random();
        int one = luckyRandom.nextInt(9);
        int ten = luckyRandom.nextInt(9);
        int hundred = luckyRandom.nextInt(9);
        lucyResult.put("one",one);
        lucyResult.put("ten",ten);
        lucyResult.put("hundred",hundred);
        System.out.println(lucyResult);
    }

    /**
     * 排列5
     */
    public void arrangement5(){
        int[] luckyNumbers = new int[]{0,1,2,3,4,5,6,7,8,9};
        Random luckyRandom = new Random();
        Set<Integer> luckyResult = new HashSet<>();
        while (luckyResult.size() < 5){
            luckyResult.add(luckyNumbers[luckyRandom.nextInt(luckyNumbers.length)]);
        }
        System.out.println("Lucky Result: " + luckyResult);
    }

    /**
     * 七星彩
     */
    public void sevenStar(){
        int[] luckySix = new int[]{0,1,2,3,4,5,6,7,8,9};
        int[] luckyOne = new int[]{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14};
        Random luckyRandom = new Random();
        Set<Integer> sixNumbers = new HashSet<>();
        Set<Integer> oneNumbers = new HashSet<>();
        while (sixNumbers.size() < 6){
            if (sixNumbers.size() < 2){
                for (Integer number : sixNumbers) {
                    if (number == 0){
                        sixNumbers.remove(number);
                    }
                }
            }
            sixNumbers.add(luckySix[luckyRandom.nextInt(luckySix.length)]);
        }
        while (oneNumbers.size() < 1){
            oneNumbers.add(luckyOne[luckyRandom.nextInt(luckyOne.length)]);
        }
        System.out.println("Six numbers: " + sixNumbers + " Lucky numbers: " + oneNumbers);
    }
}
